﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace com.sharepointutils.application.Forms
{
    public partial class AddForm : Form
    {
        public SharePointConnection Connection { get; set; }

        public AddForm()
        {
            InitializeComponent();
        }

        public AddForm(SharePointConnection connection)
        {
            Connection = connection;
            InitializeComponent();
        }


        private void btn_cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                SharePointUtilities.AddColumn(Connection.URL, Connection.Credentials, Connection.List, txt_schema.Text);
            }
            catch (Exception ex)
            {
                ExceptionForm form = new ExceptionForm(ex);
                form.ShowDialog();
            }
            this.Close();
        }
    }
}
